<template>
	<view class="content">

		<!-- 封装个人中心顶部自定义导航栏 -->
		<view class="Mine">
			<!-- left -->
			<view class="Mine-left"></view>
			<!-- center中间头像及上传 -->
			<view class="Mine-center">
				<image :src="imgUrl" mode=""></image>
				<!-- 下方usernmae -->
				<view class="username" @click="getUername">
					{{username}}
				</view>
			</view>
			<!-- 右侧设置tool -->
			<view class="Mine-right"></view>

		</view>


	</view>

</template>

<script>
	export default {
		data() {
			return {
				imgUrl: "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png",
				username: '注册 / 登录',
			};
		},
		onLoad() {
			// // 这里获取到的值为从A页面传递来的参数 usernmae
			// uni.getStorage({
			// 	key: 'username',
			// 	success: function (res) {
			// 		console.log(res.data);
			// 	}
			// });
		},
		methods: {
			getUername() {
				console.log(this.username);
				if (this.username == this.username) {
					uni.navigateTo({
						url: '/pages/login/regLogin',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				} else {
					uni.showModal({
						content: '您已登陆'
					})
				}
			}

		}
	}
</script>

<style lang="scss">
	.Mine {
		height: 100px;
		padding: 12px;
		background-color: red;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		.Mine-center {
			display: flex;
			flex-direction: column;

			image {
				border-radius: 50%;
				width: 120rpx;
				height: 120rpx;
			}

			.username {
				cursor: pointer;
				font-size: 12px;
				text-align: center;
				color: #c5c5c5;
				margin-top: 8px;
			}
		}
	}
</style>